package demo.servlet;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Component;

import demo.entity.User;
import demo.entity.UploadedFile;
import demo.entity.service.UserService;

/**
 * Servlet to download Uploaded from User
 */
@Component("userDownloadServlet")
public class UserDownloadServlet extends DownloadServlet {
    private static final long serialVersionUID = 1L;
    @SuppressWarnings("unused")
    private final Log logger = LogFactory.getLog(getClass());

    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        String username = request.getParameter("username");

        final User user = UserService.getInstance().getUserDao().findByPrimaryKey(username);

        // TODO: implement retrieval of uploaded file
        UploadedFile uploadedFile = null;
        streamUploadedFile(response, uploadedFile);
    }

 }// clickframes::version=1231784905::clickframes